export function resolvePath (base: string, ...args: string[]) {
  const ret = base.split('/')
  args.forEach(v => {
    if (v === '..') ret.pop()
    else ret.push(...v.split('/'))
  })
  return ret.join('/')
}

export function suffix (name: string) {
  if (!name) return ''
  let r
  if (name.startsWith('http://') || name.startsWith('https://')) {
    const url = new URL(name)
    r = url.pathname
  } else {
    r = name
  }
  return r.split('.').slice(-1)[0] || ''
}
